﻿//********************************************************************************//
//创建日期：<创建日期，2010-08-02>
//创建作者：<王一飞，wangyifei@shanghai3h.com>
//功能说明：WTB_SHOULIXX实体层次
//********************************************************************************//
#region Entity
namespace Entity{
	using System;
	using System.Xml;
	[Serializable()]
	public class WTB_SHOULIXX{

		private int m_dec_id;
		/// <summary>
		/// 唯一列，禁止关联
		/// </summary>
		public int ID{get{return m_dec_id;}set{m_dec_id=value;}}

		private string m_str_s_zhubiaobh;
		/// <summary>
		/// 主表编号，关联wtb_yewuzb
		/// </summary>
		public string S_ZHUBIAOBH{get{return m_str_s_zhubiaobh;}set{m_str_s_zhubiaobh=value;}}

		private string m_str_incident_id;
		/// <summary>
		/// 申请单ID
		/// </summary>
		public string INCIDENT_ID{get{return m_str_incident_id;}set{m_str_incident_id=value;}}

		private string m_str_contact_num;
		/// <summary>
		/// 联系号码
		/// </summary>
		public string CONTACT_NUM{get{return m_str_contact_num;}set{m_str_contact_num=value;}}

		private string m_str_source;
		/// <summary>
		/// 提交渠道 1：一网通办网站，5: 微信小程序，6: 支付宝小程序，7: 市民云 90. 水务官网, 91. 水务微信小程序, 92. 水务App

		/// </summary>
		public string SOURCE{get{return m_str_source;}set{m_str_source=value;}}

		private string m_str_bdczl;
		/// <summary>
		/// 不动产坐落
		/// </summary>
		public string BDCZL{get{return m_str_bdczl;}set{m_str_bdczl=value;}}

		private string m_str_fczjhm;
		/// <summary>
		/// 房产证件号码
		/// </summary>
		public string FCZJHM{get{return m_str_fczjhm;}set{m_str_fczjhm=value;}}

		private string m_str_bdcdbrq;
		/// <summary>
		/// 不动产登簿日期
		/// </summary>
		public string BDCDBRQ{get{return m_str_bdcdbrq;}set{m_str_bdcdbrq=value;}}

		private string m_str_nsrsbh;
		/// <summary>
		/// 纳税人识别号
		/// </summary>
		public string NSRSBH{get{return m_str_nsrsbh;}set{m_str_nsrsbh=value;}}

		private string m_str_fczjlx;
		/// <summary>
		/// 房产证件类型
		/// </summary>
		public string FCZJLX{get{return m_str_fczjlx;}set{m_str_fczjlx=value;}}

		private string m_str_booktime;
		/// <summary>
		/// 预约时间
		/// </summary>
		public string BOOKTIME{get{return m_str_booktime;}set{m_str_booktime=value;}}

		private string m_str_watertype;
		/// <summary>
		/// 企业用水性质
		/// </summary>
		public string WATERTYPE{get{return m_str_watertype;}set{m_str_watertype=value;}}

		private string m_str_reason;
		/// <summary>
		/// 销户原因
		/// </summary>
		public string REASON{get{return m_str_reason;}set{m_str_reason=value;}}

		private string m_str_company_id;
		/// <summary>
		/// 水司
		/// </summary>
		public string COMPANY_ID{get{return m_str_company_id;}set{m_str_company_id=value;}}

		private string m_str_s_beiyong1;
		/// <summary>
		/// 
		/// </summary>
		public string S_BEIYONG1{get{return m_str_s_beiyong1;}set{m_str_s_beiyong1=value;}}

		private string m_str_s_beiyong2;
		/// <summary>
		/// 
		/// </summary>
		public string S_BEIYONG2{get{return m_str_s_beiyong2;}set{m_str_s_beiyong2=value;}}

		private string m_str_s_beiyong3;
		/// <summary>
		/// 
		/// </summary>
		public string S_BEIYONG3{get{return m_str_s_beiyong3;}set{m_str_s_beiyong3=value;}}

		private string m_str_s_beiyong4;
		/// <summary>
		/// 
		/// </summary>
		public string S_BEIYONG4{get{return m_str_s_beiyong4;}set{m_str_s_beiyong4=value;}}

		private string m_str_s_beiyong5;
		/// <summary>
		/// 
		/// </summary>
		public string S_BEIYONG5{get{return m_str_s_beiyong5;}set{m_str_s_beiyong5=value;}}

		private string m_str_s_beiyong6;
		/// <summary>
		/// 
		/// </summary>
		public string S_BEIYONG6{get{return m_str_s_beiyong6;}set{m_str_s_beiyong6=value;}}
		public WTB_SHOULIXX()
		{
		}
}}
#endregion
#region EntityProcess
namespace Access.BLL
{
	using System;
	using System.Data;
	//using System.Data.OracleClient;
	using Entity;
	using System.Configuration;
	using System.Data.Common;
	using Platform.Data;
	using Oracle.DataAccess.Client;
    using Oracle.DataAccess.Types;
    using Oracle.DataAccess;
	public class WTB_SHOULIXXProcess{
    	#region Field
		protected string conn;
		#endregion
		#region Construction
        public WTB_SHOULIXXProcess(){conn = Platform.Configuration.ConfigHelper.BusinessConnString;}
		#endregion
		#region public
		
		/// <summary>
        /// 根据WTB_SHOULIXX实体添加或者修改WTB_SHOULIXX信息
        /// </summary>
		public bool InsertOrUpdate(WTB_SHOULIXX WTB_SHOULIXX,OracleTransaction Transaction){
			if (WTB_SHOULIXX.ID == 0)
            {
                InsertWTB_SHOULIXX(WTB_SHOULIXX, Transaction);
            }
            else
            {
                UpdateWTB_SHOULIXX(WTB_SHOULIXX, Transaction);
            }
            return WTB_SHOULIXX.ID == 0 ? false : true;
        }
		
		/// <summary>
        /// 根据WTB_SHOULIXX实体添加或修改WTB_SHOULIXX信息
        /// </summary>
		public bool InsertOrUpdate(WTB_SHOULIXX WTB_SHOULIXX){
			return InsertOrUpdate(WTB_SHOULIXX,null);
        }
	
		
		
		/// <summary>
        /// 根据WTB_SHOULIXX主键删除WTB_SHOULIXX信息
        /// </summary>
		/// <param name="ID"></param>
		public bool DeleteWTB_SHOULIXX(int ID,OracleTransaction Transaction)
        {
            string spName = "CS_DelWTB_SHOULIXX";
            OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
			storedParams[0].Value = ID;
            int result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery((OracleTransaction)Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result==0?false:true;
        }
		
		/// <summary>
        /// 根据WTB_SHOULIXX主键删除WTB_SHOULIXX信息
        /// </summary>
		/// <param name="ID"></param>
		public bool DeleteWTB_SHOULIXX(int ID)
        {
           	return DeleteWTB_SHOULIXX(ID,null);
        }
		
		/// <summary>
        /// 根据条件删除WTB_SHOULIXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
		public bool DeleteWTB_SHOULIXXesDynamic(string WhereClause, OracleTransaction Transaction)
        {
            string spName = "CS_DelWTB_SHOULIXXesDyn";
            OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value = WhereClause;
            int result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery((OracleTransaction)Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;
        }
		
		/// <summary>
        /// 根据条件删除WTB_SHOULIXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(Oracle语句)不带where</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>如果删除成功，返回true,否则返回fals</returns>
		public bool DeleteWTB_SHOULIXXesDynamic(string WhereClause)
        {
           return DeleteWTB_SHOULIXXesDynamic(WhereClause,null);
        }
		
		/// <summary>
        /// 根据WTB_SHOULIXX主键选择WTB_SHOULIXX信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>WTB_SHOULIXX信息</returns>
		public WTB_SHOULIXX SelectWTB_SHOULIXX(int ID,OracleTransaction Transaction)
        {
            string spName = "CS_SelWTB_SHOULIXX";
            OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
			storedParams[0].Value = ID;
            OracleDataReader rd;
            if (Transaction == null)
                rd = OracleHelper.ExecuteReader(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                rd = OracleHelper.ExecuteReader((OracleTransaction)Transaction, CommandType.StoredProcedure, spName, storedParams);
            if (rd.Read())
            {
                WTB_SHOULIXX WTB_SHOULIXX = PopulateWTB_SHOULIXX(rd);
                rd.Close();
				return WTB_SHOULIXX;
            }
            else
                return null;
        }
		
		/// <summary>
        /// 根据WTB_SHOULIXX主键选择WTB_SHOULIXX信息
        /// </summary>
        /// <returns>WTB_SHOULIXX信息</returns>
		public WTB_SHOULIXX SelectWTB_SHOULIXX(int ID)
        {
			return SelectWTB_SHOULIXX(ID,null);       
        }
		
		/// <summary>
        /// 选择所有WTB_SHOULIXX信息
        /// </summary>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>所有WTB_SHOULIXX信息</returns>
		public DataTable SelectWTB_SHOULIXXesAll(OracleTransaction Transaction)
        {
            string spName = "CS_SelWTB_SHOULIXXesAll";
			OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            DataSet ds=null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName,storedParams);
            else
                ds = OracleHelper.ExecuteDataset((OracleTransaction)Transaction, CommandType.StoredProcedure, spName,storedParams);
			if(ds!=null&&ds.Tables.Count>0){
				AddRowNumber(ds.Tables[0]);
				return ds.Tables[0];
			}
			else
				return null;
        }
		
		/// <summary>
        /// 选择所有WTB_SHOULIXX信息
        /// </summary>
        /// <returns>所有WTB_SHOULIXX信息</returns>
		public DataTable SelectWTB_SHOULIXXesAll()
        {
            return SelectWTB_SHOULIXXesAll(null);
        }
		
		/// <summary>
        /// 根据条件选择WTB_SHOULIXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>WTB_SHOULIXX信息</returns>
		public DataTable SelectWTB_SHOULIXXesDynamic(string WhereClause, string OrderByExpression, OracleTransaction Transaction)
        {
            string spName = "CS_SelWTB_SHOULIXXesDyn";
            OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value =string.IsNullOrEmpty(WhereClause.Trim())?"1=1":WhereClause;
            storedParams[1].Value = OrderByExpression;
            DataSet ds=null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName,storedParams);
            else
                ds = OracleHelper.ExecuteDataset((OracleTransaction)Transaction, CommandType.StoredProcedure, spName,storedParams);
			if(ds!=null&&ds.Tables.Count>0){
				AddRowNumber(ds.Tables[0]);
				return ds.Tables[0];
			}
			else
				return null;
        }		
		
		
		/// <summary>
        /// 根据条件选择WTB_SHOULIXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
        /// <returns>WTB_SHOULIXX信息</returns>
		public DataTable SelectWTB_SHOULIXXesDynamic(string WhereClause, string OrderByExpression)
        {
            return SelectWTB_SHOULIXXesDynamic(WhereClause, OrderByExpression,null);
        }		
		
		
		
		/// <summary>
        /// 根据条件选择WTB_SHOULIXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
		/// <param name="PageIndex">页码</param>
		/// <param name="PageSize">页数</param>
        /// <param name="Transaction">事务，如果为null,则不做事务</param>
        /// <returns>WTB_SHOULIXX信息</returns>
		public DataTable SelectWTB_SHOULIXXesDynamic(string WhereClause, string OrderByExpression, int PageIndex,int PageSize,OracleTransaction Transaction)
        {
            string spName = "CS_SelWTB_SHOULIXXesDynPaged";
            OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
            storedParams[0].Value =string.IsNullOrEmpty(WhereClause.Trim())?"1=1":WhereClause;
            storedParams[1].Value = OrderByExpression;
			storedParams[2].Value = PageIndex;
			storedParams[3].Value = PageSize;
            DataSet ds=null;
            if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName,storedParams);
            else
                ds = OracleHelper.ExecuteDataset((OracleTransaction)Transaction, CommandType.StoredProcedure, spName,storedParams);
			if(ds!=null&&ds.Tables.Count>0){
				AddRowNumber(ds.Tables[0]);
				return ds.Tables[0];
			}
			else
				return null;
        }		
		
		
		/// <summary>
        /// 根据条件选择WTB_SHOULIXX信息
        /// </summary>
        /// <param name="WhereClause">条件子句(不带where)</param>
        /// <param name="OrderByExpression">排序子句</param>
		/// <param name="PageIndex">页码</param>
		/// <param name="PageSize">页数</param>
        /// <returns>WTB_SHOULIXX信息</returns>
		public DataTable SelectWTB_SHOULIXXesDynamic(string WhereClause, string OrderByExpression, int PageIndex,int PageSize)
        {
            return SelectWTB_SHOULIXXesDynamic(WhereClause, OrderByExpression,PageIndex,PageSize,null);
        }		
		
		/// <summary>
		///根据条件更新WTB_SHOULIXX字段
		/// </summary>
		/// <returns>受影响行数</returns>
		public int UpdateWTB_SHOULIXXesDynamic(string UpdateValue,string WhereClause,OracleTransaction Transaction)
		{
			int result = 0;
			if(UpdateValue == "" || WhereClause == "")
			{
				return 0;	
			}
			string spName = "CS_UpdWTB_SHOULIXXDyn";
			OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
			DataSet ds=null;
			storedParams[0].Value = UpdateValue;
            storedParams[1].Value = WhereClause;
			if (Transaction == null)
                ds = OracleHelper.ExecuteDataset(conn, CommandType.StoredProcedure, spName,storedParams);
            else
                ds = OracleHelper.ExecuteDataset((OracleTransaction)Transaction, CommandType.StoredProcedure, spName,storedParams);
			result = Convert.ToInt32(storedParams[2].Value);
			return result;
		}
		
		/// <summary>
		///根据条件更新WTB_SHOULIXX字段
		/// </summary>
		/// <returns>受影响行数</returns>
		public int UpdateWTB_SHOULIXXesDynamic(string UpdateValue,string WhereClause)
		{
			return UpdateWTB_SHOULIXXesDynamic(UpdateValue,WhereClause,null);
		}
		
		
		#endregion
		#region Private
		
		private int InsertWTB_SHOULIXX(WTB_SHOULIXX WTB_SHOULIXX,OracleTransaction Transaction)
		{
            string spName = "CS_InsWTB_SHOULIXX";
            OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
			storedParams[0].Value = WTB_SHOULIXX.S_ZHUBIAOBH;
			storedParams[1].Value = WTB_SHOULIXX.INCIDENT_ID;
			storedParams[2].Value = WTB_SHOULIXX.CONTACT_NUM;
			storedParams[3].Value = WTB_SHOULIXX.SOURCE;
			storedParams[4].Value = WTB_SHOULIXX.BDCZL;
			storedParams[5].Value = WTB_SHOULIXX.FCZJHM;
			storedParams[6].Value = WTB_SHOULIXX.BDCDBRQ;
			storedParams[7].Value = WTB_SHOULIXX.NSRSBH;
			storedParams[8].Value = WTB_SHOULIXX.FCZJLX;
			storedParams[9].Value = WTB_SHOULIXX.BOOKTIME;
			storedParams[10].Value = WTB_SHOULIXX.WATERTYPE;
			storedParams[11].Value = WTB_SHOULIXX.REASON;
			storedParams[12].Value = WTB_SHOULIXX.COMPANY_ID;
			storedParams[13].Value = WTB_SHOULIXX.S_BEIYONG1;
			storedParams[14].Value = WTB_SHOULIXX.S_BEIYONG2;
			storedParams[15].Value = WTB_SHOULIXX.S_BEIYONG3;
			storedParams[16].Value = WTB_SHOULIXX.S_BEIYONG4;
			storedParams[17].Value = WTB_SHOULIXX.S_BEIYONG5;
			storedParams[18].Value = WTB_SHOULIXX.S_BEIYONG6;
            int result=0;
            if (Transaction == null)
                result=OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result=OracleHelper.ExecuteNonQuery((OracleTransaction)Transaction, CommandType.StoredProcedure, spName, storedParams);
			WTB_SHOULIXX.ID=Convert.ToInt32(storedParams[19].Value);
            return result;
        }
		private bool UpdateWTB_SHOULIXX(WTB_SHOULIXX WTB_SHOULIXX,OracleTransaction Transaction)
        {
            string spName = "CS_UpdWTB_SHOULIXX";
            OracleParameter[] storedParams = OracleHelperParameterCache.GetSpParameterSet(conn, spName);
			storedParams[0].Value = WTB_SHOULIXX.S_ZHUBIAOBH;
			storedParams[1].Value = WTB_SHOULIXX.INCIDENT_ID;
			storedParams[2].Value = WTB_SHOULIXX.CONTACT_NUM;
			storedParams[3].Value = WTB_SHOULIXX.SOURCE;
			storedParams[4].Value = WTB_SHOULIXX.BDCZL;
			storedParams[5].Value = WTB_SHOULIXX.FCZJHM;
			storedParams[6].Value = WTB_SHOULIXX.BDCDBRQ;
			storedParams[7].Value = WTB_SHOULIXX.NSRSBH;
			storedParams[8].Value = WTB_SHOULIXX.FCZJLX;
			storedParams[9].Value = WTB_SHOULIXX.BOOKTIME;
			storedParams[10].Value = WTB_SHOULIXX.WATERTYPE;
			storedParams[11].Value = WTB_SHOULIXX.REASON;
			storedParams[12].Value = WTB_SHOULIXX.COMPANY_ID;
			storedParams[13].Value = WTB_SHOULIXX.S_BEIYONG1;
			storedParams[14].Value = WTB_SHOULIXX.S_BEIYONG2;
			storedParams[15].Value = WTB_SHOULIXX.S_BEIYONG3;
			storedParams[16].Value = WTB_SHOULIXX.S_BEIYONG4;
			storedParams[17].Value = WTB_SHOULIXX.S_BEIYONG5;
			storedParams[18].Value = WTB_SHOULIXX.S_BEIYONG6;
			storedParams[19].Value = WTB_SHOULIXX.ID;
			int result = 0;
            if (Transaction == null)
                result = OracleHelper.ExecuteNonQuery(conn, CommandType.StoredProcedure, spName, storedParams);
            else
                result = OracleHelper.ExecuteNonQuery((OracleTransaction)Transaction, CommandType.StoredProcedure, spName, storedParams);
            return result == 0 ? false : true;            
        }
		
		
		private WTB_SHOULIXX PopulateWTB_SHOULIXX(IDataReader dr)
        {
			WTB_SHOULIXX WTB_SHOULIXX=new WTB_SHOULIXX();
				WTB_SHOULIXX.ID = Convert.ToInt32(dr["ID"].ToString());
			WTB_SHOULIXX.S_ZHUBIAOBH=dr["S_ZHUBIAOBH"] == DBNull.Value ? null : (string)dr["S_ZHUBIAOBH"];
			WTB_SHOULIXX.INCIDENT_ID=dr["INCIDENT_ID"] == DBNull.Value ? null : (string)dr["INCIDENT_ID"];
			WTB_SHOULIXX.CONTACT_NUM=dr["CONTACT_NUM"] == DBNull.Value ? null : (string)dr["CONTACT_NUM"];
			WTB_SHOULIXX.SOURCE=dr["SOURCE"] == DBNull.Value ? null : (string)dr["SOURCE"];
			WTB_SHOULIXX.BDCZL=dr["BDCZL"] == DBNull.Value ? null : (string)dr["BDCZL"];
			WTB_SHOULIXX.FCZJHM=dr["FCZJHM"] == DBNull.Value ? null : (string)dr["FCZJHM"];
			WTB_SHOULIXX.BDCDBRQ=dr["BDCDBRQ"] == DBNull.Value ? null : (string)dr["BDCDBRQ"];
			WTB_SHOULIXX.NSRSBH=dr["NSRSBH"] == DBNull.Value ? null : (string)dr["NSRSBH"];
			WTB_SHOULIXX.FCZJLX=dr["FCZJLX"] == DBNull.Value ? null : (string)dr["FCZJLX"];
			WTB_SHOULIXX.BOOKTIME=dr["BOOKTIME"] == DBNull.Value ? null : (string)dr["BOOKTIME"];
			WTB_SHOULIXX.WATERTYPE=dr["WATERTYPE"] == DBNull.Value ? null : (string)dr["WATERTYPE"];
			WTB_SHOULIXX.REASON=dr["REASON"] == DBNull.Value ? null : (string)dr["REASON"];
			WTB_SHOULIXX.COMPANY_ID=dr["COMPANY_ID"] == DBNull.Value ? null : (string)dr["COMPANY_ID"];
			WTB_SHOULIXX.S_BEIYONG1=dr["S_BEIYONG1"] == DBNull.Value ? null : (string)dr["S_BEIYONG1"];
			WTB_SHOULIXX.S_BEIYONG2=dr["S_BEIYONG2"] == DBNull.Value ? null : (string)dr["S_BEIYONG2"];
			WTB_SHOULIXX.S_BEIYONG3=dr["S_BEIYONG3"] == DBNull.Value ? null : (string)dr["S_BEIYONG3"];
			WTB_SHOULIXX.S_BEIYONG4=dr["S_BEIYONG4"] == DBNull.Value ? null : (string)dr["S_BEIYONG4"];
			WTB_SHOULIXX.S_BEIYONG5=dr["S_BEIYONG5"] == DBNull.Value ? null : (string)dr["S_BEIYONG5"];
			WTB_SHOULIXX.S_BEIYONG6=dr["S_BEIYONG6"] == DBNull.Value ? null : (string)dr["S_BEIYONG6"];
			return WTB_SHOULIXX;
        }
		
		
		private void AddRowNumber(DataTable dt)
		{
			dt.Columns.Add(new DataColumn("RowNumber",typeof(int)));
            for (int i = 0; i < dt.Rows.Count; i++)
            {
                dt.Rows[i][dt.Columns.Count - 1] = i + 1;
            }
		}
		#endregion
    }
}
#endregion